#include "intprocess.h"


void TIM3_PWM_IntProcess(TIM_HandleTypeDef *htim)
{
	YSO_End();
}
void TIM4_PWM_IntProcess(TIM_HandleTypeDef *htim)
{
	XSO_End();
}

void TIM2_1ms_IntProcess(void)
{
	//暂停
    if(CO.pauseFlag == 1)
    {
    	return;
    }
	//状态判断
	if(XSO.taragetPulsePos==XSO.currentPulsePos&& YSO.taragetPulsePos==YSO.currentPulsePos)
	{
		CO.workStatus = FREE;
	}
	locatesmooth();
	YSO_Start();
	XSO_Start();
}

void raspiDataProcess(RxProBufDef theBuf)

{
  uint8_t mood=0;
  mood=judgmenMood(theBuf );

	uint8_t* tempheader = &theBuf.rxProBuf[6];
  if(mood!=0){

	    if(mood==REDCOORDINATE)
	    {
	    	//接收到红色坐标
	   	  //HAL_UART_Transmit(&huart2, "red", 3,100 );
		  g_red_coordinate=singleLightCoordinateGet(tempheader);


		  positionCorrection(set);
		   g_red_coordinate.xCoordinate=(g_red_coordinate.xCoordinate-g_origin_coordinate.xCoordinate)/(float)g_topright_coordinate.xCoordinate;
		   g_red_coordinate.yCoordinate=(g_red_coordinate.yCoordinate-g_origin_coordinate.yCoordinate)/(float)g_topright_coordinate.yCoordinate;



	    }

	   if(mood==GREENCOORDINATE)
	   {//接收到绿色坐标
		   	  //HAL_UART_Transmit(&huart2, "green",5,100 );

		   g_green_coordinate=singleLightCoordinateGet(tempheader);

	   }

	   if(mood==RECTANGLE)
	   {//接收到矩形框坐标
		   //HAL_UART_Transmit(&huart2, "rec", 3,100 );

		   rectangleCoordinateGet(tempheader,g_rectangle_coordinate); //矩形坐标

	   }

	   if(mood==REDANDGREENCOORDINATE){//接收到双色激光坐标

	   }

	   if(mood==RASPIMOOD){      //接收到树莓派当前工作模式
		   g_raspi_mood=getRaspiMood(tempheader);
	   }
  }
}
